package com.example.helloworld;

public class StringTest {
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        sb.append("Hello, ");
        sb.append("World!");
        System.out.println(sb.toString());
        sb.insert(0, "Java ");
        System.out.println(sb.toString());
        sb.delete(0, 5);
        System.out.println(sb.toString());

        // 使用StringBuffer练习
        StringBuffer sb2 = new StringBuffer();
        sb2.append("Hello2, ");
        sb2.append("World2!");
        System.out.println(sb2.toString());
    }
}
